# 配置文件
import os
import redis
basedir = os.path.abspath(os.path.dirname(__file__))

# 基类
class Config:
    SECRET_KEY = 'FanYan879688'
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True
    SQLALCHEMY_TRACK_MODIFICATIONS = True
    FLASKY_MAIL_SUBJECT_PREFIX = '[Flask]'
    FLASKY_MAIL_SENDER = 'Flask Admin'
    FLASKY_ADMIN = 'fanfzj'
    CACHE_TYPE = 'redis'
    CACHE_REDIS_PORT = 9211
    CACHE_REDIS_DB = '1'
    CACHE_REDIS_PASSWORD = 'FanTan879425'
    @staticmethod
    def init_app(app):
        pass

# 开发环境
class DevelopmentConfig(Config):
    DEBUG = False
    SQLALCHEMY_DATABASE_URI ='mysql+pymysql://root:root@127.0.0.1/flask_codemirror?charset=utf8'

# 生产环境
class ProductionConfig(Config):
    DEBUG = False
    SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:FanTan879@fan/flask_codemirror?charset=utf8'


# 设置一个config字典，注册不同的配置环境
config = {
    'development': DevelopmentConfig,
    'production': ProductionConfig,
    'default': DevelopmentConfig
}